package com.xcity.db.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.xcity.db.entity.GuildApply;

import naga.x.db.IMapper;

public interface GuildApplyMapper extends IMapper<GuildApply> {

	String STATEMENT_FIND_BY_GUILD = GuildApplyMapper.class.getName() + ".findByGuild";
	String STATEMENT_DELETE_BY_ID = GuildApplyMapper.class.getName() + ".deleteById";
	String STATEMENT_FIND_BY_PARAM = GuildApplyMapper.class.getName() + ".findByParam";
	String STATEMENT_DELETE_BY_APPLICANT = GuildApplyMapper.class.getName() + ".deleteByApplicant";
	String STATEMENT_APPLY_COUNT_BY_PARAM = GuildApplyMapper.class.getName() + ".getApplyCountByParam";
	String STATEMENT_DELETE_BY_GUILDID = GuildApplyMapper.class.getName() + ".deleteByGuildId";
	String STATEMENT_FIND_BY_APPLICANT = GuildApplyMapper.class.getName() + ".findByApplicant";
	
	/**
	 * 通过公会ID查找
	 */
	List<GuildApply> findByGuild(int guildId);
	/**
	 * 根据id删除(单个申请)
	 */
	int deleteById(int id);
	/**
	 * 通过角色和公会ID查找
	 */
	List<GuildApply> findByParam(@Param("applicant")long applicant, @Param("guildId")long guildId);
	
	/**
	 * 根据申请人ID删除所有申请
	 */
	int deleteByApplicant(int applicant);
	/**
	 * 根据申请人ID查找对应次数
	 * @param applicant
	 */
	int getApplyCountByParam(@Param("applicant")long applicant, @Param("guildId")long guildId);
	
	/**
	 * 根据GUILDID删除所有申请
	 * @param guildId
	 * @return
	 */
	int deleteByGuildId(int guildId);
	
	/**
	 * 通过角色ID查找
	 */
	List<GuildApply> findByApplicant(int applicant);
}
